home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / Roaster-Java-WA-HTTP-CGI hack / cgi WA plugin / PluginLibrary.cp < prev   
Encoding:
Text File  |  1996-06-22  |  800 b   |  35 lines  |  [TEXT/MPS ]

  1. #include <Files.h>
  2. #include "PluginLibrary.h"
  3.  
  4.  
  5. // Stub to resolve the compiler-generated constructor references.
  6. #ifndef __MWERKS__
  7. // CW7 will not allow us to override this if #pragma pointers_in_D0 is turned on (which
  8. // it needs to be). Therefore caller must take care not to call operator new since there
  9. // is no safety net.
  10. void* operator new(size_t)
  11.     {
  12.     DebugMsg("Error - naked operator new called.");
  13.     return nil;
  14.     }
  15. #endif    //__MWERKS__
  16.  
  17.  
  18. void* operator new(size_t /*n*/, void *p) { return p; }
  19. void operator delete(void* /*p*/) {}
  20.  
  21.  
  22. extern "C" void DebugMsg(const char* msg)
  23.     {
  24.     char buf[256];
  25.     int msgLen = 0;
  26.     while (msgLen < 255 && msg[msgLen] != 0)
  27.         msgLen++;
  28.     
  29.     buf[0] = msgLen;
  30.     while (--msgLen >= 0)
  31.         buf[msgLen+1] = msg[msgLen];
  32.     
  33.     DebugStr((ConstStr255Param)buf);
  34.     } // DebugMsg
  35.